<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Boolean类型</title>
    <link rel='stylesheet' href='//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/styles/default.min.css'>
    <script src='//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/highlight.min.js'></script>
</head>
<body>
    <pre>
        <code>
            /**
                * 转化为布尔类型的几种方法
                * !
                * Boolean([val])
                * 条件判断
            */


            // 只有0、null、undefined、‘’、NaN转化之后是false其余全部是true(mou you li wai)
            console.log('0',Boolean(0));
            console.log('null',Boolean(null));
            console.log('undefined',Boolean(undefined));
            console.log('',Boolean(''));
            console.log('Nan',Boolean(NaN));

            let a
            if (!a) {
                console.log('a',a);
            }
            if('3px' - 2) {
                console.log('aaaa');
            }
        </code>
    </pre>
    <script> hljs.highlightAll(); </script>
    <script>
        /**
         * 转化为布尔类型的几种方法
         * !
         * Boolean([val])
         * 条件判断
        */


        // 只有0、null、undefined、‘’、NaN转化之后是false其余全部是true(mou you li wai)
        console.log('0',Boolean(0));
        console.log('null',Boolean(null));
        console.log('undefined',Boolean(undefined));
        console.log('',Boolean(''));
        console.log('Nan',Boolean(NaN));

        let a
        if (!a) {
            console.log('a',a);
        }
        if('3px' - 2) {
            console.log('aaaa');
        }
    </script>
</body>
</html>